Perl compile error on: "my ($export = $doc) =~ s{\.odt}{\.pdf};"

Posted by C.W.Holeman II on Stack Overflow See other posts from Stack Overflow or by C.W.Holeman II
Published on 2010-06-02T15:09:51Z Indexed on 2010/06/02 15:13 UTC
Read the original article Hit count: 151

Filed under:

Based upon SO answer "my ($export = $doc) =~ s{.odt}{.pdf};" why does this Perl script produce a compile error?

$ cat so.pl
#!/usr/bin/perl
my $doc ="x.odt";
my ($export = $doc) =~ s{\.odt}{.pdf};
$ ./so.pl
Can't declare scalar assignment in "my" at ./so.pl line 3, near ") =~"
Execution of ./so.pl aborted due to compilation errors.

© Stack Overflow or respective owner

Related posts about perl